package com.hmall.mapper;

import com.hmall.model.MallAuctionApply;
import com.hmall.util.MyMapper;
import com.hmall.vo.AuctionSelfVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 *因为application入口扫描了mapper包，不用写@Resposity spring2.0之后的注解...是mybatis自动代码生成器的缺陷?
 */
@Repository
public interface MallAuctionApplyMapper extends MyMapper<MallAuctionApply> {

    /**
     * @Date 2018/12/27 9:49
     * @Param [userId, packageNo]
     * @return com.hmall.model.MallAuctionApply
     * @Description  判断该用户是否已经申请过
     */
    MallAuctionApply selectByPackageNo(@Param("userId") Integer userId, @Param("packageNo") Long packageNo);


    /**
     * @Date 2018/12/27 10:13
     * @Param [userId]
     * @return java.util.List<com.hmall.vo.AuctionSelfVo>
     * @Description  根据用户id得到个人的竞拍申请信息
     */
    List<AuctionSelfVo> selectSelfVoByUserId(Integer userId);

    /**
     * @Date 2018/12/27 15:12
     * @Param [rejectStatus, packageNo]
     * @return void
     * @Description //TODO 更新一些列的人的申请信息状态变成指定的状态
     */
    void updateStatusByPackageNo(@Param("status") int rejectStatus, @Param("packageNo") Long packageNo);

    /**
     * @Date 2019/1/15 15:05
     * @Param [opinion, packageNo]
     * @return void
     * @Description 更新个人申请的备注
     */
    void updateOpinionByPackageNo(@Param("opinion") String opinion, @Param("packageNo") Long packageNo);

    MallAuctionApply selectByPackageNoWithStatus(@Param("userId") Integer userId, @Param("packageNo") Long packageNo, @Param("status") int status);
}